<?php
/**
 * @filesource					ChooseGraveAction.class.php
 * @desc						墓地选址
 * 
 * @author						houyining
 * @copyright					hou.yining@gmail.com
 * @date						2011-05-02
 */

class ChooseGraveAction extends CommonAction{
	public function index(){
		$crumb_info = array(
			array('uri' => '__URL__', 'title' => L('choose_grave_manage'), 'sort' => C('CRUMB_DEFAULT')),
			array('uri' => '__URL__/index', 'title' => L('list_choose_grave'), 'sort' => C('CRUMB_LAST')),
		);
		
		$this->_mergeCrumbInfo($crumb_info);
		$this->_action_link = array(
			array('uri' => '__URL__/add', 'title' => L('add_choose_grave')),
			);
		
		$choose_grave = new ChooseGraveModel();
		$choose_grave_list = $choose_grave->getChooseGraveList();	
		
		$this->assign('choose_grave_list', $choose_grave_list);
		$this->assign('crumb_info', $this->_crumb_info);
		$this->assign('action_link', $this->_action_link);
		parent::index();
	}
	
	public function add(){
		$crumb_info = array(
			array('uri' => '__URL__', 'title' => L('choose_grave_manage'), 'sort' => C('CRUMB_DEFAULT')),
			array('uri' => '__URL__/add', 'title' => L('add_choose_grave'), 'sort' => C('CRUMB_LAST')),
		);
		
		$this->_mergeCrumbInfo($crumb_info);
		$this->_action_link = array(
			array('uri' => '__URL__/index', 'title' => L('list_choose_grave')),
			);
		
		$customer_trend_type = M("CustomerTrendType");
		$trend_types = $customer_trend_type->field("id, name")->where(array('status' => 1))->select(); 
		
		$this->assign('customer_trend_types', $trend_types);		
		$this->assign('crumb_info', $this->_crumb_info);
		$this->assign('action_link', $this->_action_link);
		parent::add();
	}
	
	public function show(){
		$crumb_info = array(
			array('uri' => '__URL__', 'title' => L('choose_grave_manage'), 'sort' => C('CRUMB_DEFAULT')),
			array('uri' => '__URL__/index', 'title' => L('show'), 'sort' => C('CRUMB_LAST')),
		);
		
		$this->_mergeCrumbInfo($crumb_info);
		$this->_action_link = array(
			array('uri' => '__URL__/add', 'title' => L('list_choose_grave')),
			);
		
		$choose_grave_id = $_REQUEST['id'];
		
		$choose_grave = new ChooseGraveModel();
		$choose_grave_info = $choose_grave->getChooseGraveInfo($choose_grave_id);
		
		//取得申请人信息
		$general_customer = new GeneralCustomerModel();
		$applicant_info = $general_customer->getCustomerInfo($choose_grave_info['applicant_id']);

		$this->assign('applicant_info', $applicant_info);
		$this->assign('crumb_info', $this->_crumb_info);
		$this->assign('action_link', $this->_action_link);
		$this->display();
	}
	
	public function edit(){
		
	}
}
?>